#encoding:utf-8

import urllib.request
import urllib.parse  #将字典解析成参数字符串

#urlencode 详解

params = {
    'name':'zhangsan',
    'age':18,
    "sex":1,
    "greet":"你好",
}

result = urllib.parse.urlencode(params)

print(result)
#name=zhangsan&age=18&sex=1&greet=hello+world